<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<body>
     <fieldset class="layui-elem-field layui-field-title site-title">
			<legend><a name="fixbar" style="font-size: 16px; color: #ce2424;">文章管理</a></legend>
		</fieldset>
		<form class="layui-form" action="save" id="myForm" method="post" lay-filter="stuform">
			<div class="layui-form-item">
				<div class="layui-inline">
					<label class="layui-form-label">标题：</label>
			<div class="layui-input-inline">
				<input type="text" name="title" value="${param.title}" class="layui-input" />
			</div>
				</div>
				<div class="layui-inline">
					<label class="layui-form-label">类型：</label>
				<div class="layui-input-inline">
					<input type="text" name="type" value="${param.type}" class="layui-input" />
				</div>
				</div>
				<div class="layui-inline">
					<button type="button" class="layui-btn layui-btn-danger" onclick="search()" >查询</button>
					<button type="button" class="layui-btn layui-btn-danger" onclick="empty()" >清空</button>
				</div>
			</div>
		</form>
     
	<table class="layui-hide" id = "articleManagement" lay-filter="articleManagement"></table>
	<script type="text/html" id="toolbarDemo">
		<div class="layui-btn-container">
			<button class="layui-btn layui-btn-sm" lay-event="add_panel">新增</button>
  		</div>
	</script>
	<script type="text/html" id="barDemo3">
  		<a class="layui-btn layui-btn-sm" lay-event="visit"><i class="layui-icon">&#xe609;</i>访问</a>
		<button class="layui-btn layui-btn-sm" lay-event="update_panel2">修改</button>
		<button class="layui-btn layui-btn-sm" lay-event="delete2">删除</button>
	</script>
	
	<script type="text/javascript">
		var option={
			elem:'#articleManagement',
			title:'文章管理',
			path:'articleManagement',
			height:'full-265',
			addurl:'edit',
			where:{title:'${param.title}',type:'${param.type}'},
			toolbar:'#toolbarDemo',
			cols: [[
				{field: 'id', title: 'ID', hide: true, usersize: true, sort: true},
				{field: 'title', title: '标题'},
				{field: 'type', title: '类型'},
				{fixed: 'right', title:'操作', toolbar: '#barDemo3', width:260}
			]] 
		}
		var currRow="${param.currRow==null?'null':param.currRow}";
		var limit=${param.limit==null?'null':param.limit};
		var page=${param.page==null?'null':param.page};
		var classTable=new LayUiTable(option,currRow,limit,page);
		classTable.init();
		
		layui.use("table", function(){
			var table = layui.table;
			table.on('tool(articleManagement)', function(obj){
				var id = obj.data.id;
				if(obj.event === 'visit'){
					window.open("articleManagement/visit?id="+id);
				}
			});
		});
		
		function search(){
			classTable.search();
		}
		
		function empty(){
			classTable.empty();
		}
	</script>
</body>
</html>